package com.icart.repositories;


import com.icart.entities.BiChnstaffEntity;
import com.icart.entities.BiUserEntity;
import com.icart.entities.CuCustinfoEntity;
import org.springframework.context.annotation.Scope;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
@Scope("prototype")
public interface BiUserRepository extends BaseRepository<BiUserEntity,Integer> {
    /*登录*/
    @Query(nativeQuery = true,value = "select * from bi_user where username=?1 and pwd=?2 LIMIT 0,1")
    BiUserEntity login(String username,String pwd);

    /*登录是判断有没有openid*/
    @Query(nativeQuery = true,value = "select * from bi_user where wxid=?1 LIMIT 0,1")
    BiUserEntity loginfindopenid(String openid);

    /*修改微信绑定*/
    @Transactional
    @Query(nativeQuery = true,value = "update bi_user set wxid=?1 where staffid=?2")
    @Modifying(clearAutomatically = true)
    Integer updateUserwxid(String weixin,Long staffid);
}

